Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(schema): Add versions field to project secrets and variables response #590

Merged
merged 4 commits into from
Dec 16, 2024

Conversation

muntaxir4
Copy link
Contributor

@muntaxir4 muntaxir4 commented Dec 13, 2024

User description

Description

In @keyshade/scehma fix inconsistencies of project response schema for variable and secret

Developer's checklist

  • My PR follows the style guidelines of this project
  • I have performed a self-check on my work

If changes are made in the code:

  • I have followed the coding guidelines
  • My changes in code generate no new warnings
  • My changes are breaking another fix/feature of the project
  • I have added test cases to show that my feature works
  • I have added relevant screenshots in my PR
  • There are no UI/UX issues

Documentation Update

  • This PR requires an update to the documentation at docs.keyshade.xyz
  • I have made the necessary updates to the documentation, or no documentation changes are required.

PR Type

Enhancement


Description

  • Enhanced project secrets schema by adding versions field containing environment details (id, slug, name)
  • Enhanced project variables schema by adding versions field containing environment details (id, slug)
  • Restructured GetAllVariablesOfProjectResponseSchema for better organization
  • Updated corresponding test cases to validate the new schema changes
  • Improved schema consistency between variables and secrets responses

Changes walkthrough 📝

Relevant files
Enhancement
index.ts
Add versions field to secret schema response                         

packages/schema/src/secret/index.ts

  • Added versions field to secret schema with environment details (id,
    slug, name)
  • Extended the GetAllSecretsOfProjectResponseSchema with version
    information
  • +10/-1   
    index.ts
    Add versions field to variable schema response                     

    packages/schema/src/variable/index.ts

  • Restructured GetAllVariablesOfProjectResponseSchema to include
    versions array
  • Added environment details (id, slug) to variable versions
  • +10/-2   
    Tests
    secret.spec.ts
    Update secret schema tests with version validation             

    packages/schema/tests/secret.spec.ts

  • Updated test cases to include versions field in secret schema
    validation
  • Added test coverage for environment details in versions array
  • +11/-1   
    variable.spec.ts
    Update variable schema tests with version validation         

    packages/schema/tests/variable.spec.ts

  • Updated test structure for GetAllVariablesOfProjectResponseSchema
  • Added test cases for versions array with environment details
  • +17/-9   

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Schema Consistency
    The variable schema includes fewer environment fields compared to secrets schema (missing 'name' field). Consider aligning both schemas for consistency.

    Test Coverage
    Test case only validates successful scenario. Consider adding negative test cases to verify schema validation errors.

    Copy link
    Contributor

    codiumai-pr-agent-free bot commented Dec 13, 2024

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    General
    ✅ Ensure schema consistency by including all required environment fields

    Add the missing name field to the environment object in variable versions to
    maintain consistency with the secret schema.

    packages/schema/src/variable/index.ts [105-108]

     environment: z.object({
       id: EnvironmentSchema.shape.id,
    -  slug: EnvironmentSchema.shape.slug
    +  slug: EnvironmentSchema.shape.slug,
    +  name: EnvironmentSchema.shape.name
     })

    [Suggestion has been applied]

    Suggestion importance[1-10]: 8

    Why: This is a high-impact suggestion that identifies an important schema inconsistency between secret and variable implementations. Adding the missing 'name' field ensures API consistency and prevents potential integration issues.

    8

    @rajdip-b rajdip-b self-requested a review as a code owner December 14, 2024 07:27
    @rajdip-b rajdip-b merged commit 755ea46 into keyshade-xyz:develop Dec 16, 2024
    5 checks passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants